﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Globalization;
using System.Threading;

namespace Test.Formatting
{
    public class LegacyFormatMethods
    {

        

        private const string SatzEnde = "\r\n";

        public static char leerzeichen = ' ';
        public static char nullzeichen = '0';
        public static string leerA = " ";
        public static string leerN = "0";

        public string GetFormattedWeight1(double weight)
        {
            if (weight == (double)0)
            {
                return leerN;
            }
            else
            {
                return System.Convert.ToString(Math.Ceiling(weight));  
            }
        }



        public static string GetFormattedWeightSchenkerDachser(double weight)
        {
            if (weight == (double)0)
            {
                return "";
            }
            else
            {
                weight = weight * 1000;
                string weightString = System.Convert.ToString(weight);
                return weightString;

                
            }
        }



        /// <summary>
        /// 
        /// </summary>
        /// <param name="number"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public static string GetFormattedWeightLegacy_1(double weight, string culture)
        {
            if (weight == (double)0)
            {
                return "";
            }
            else
            {
                string weightString = "";
                CultureInfo ci = Thread.CurrentThread.CurrentCulture;
                try
                {
                    Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
                    weightString = String.Format("{0:###,##0.000}", weight);
                }
                finally
                {
                    Thread.CurrentThread.CurrentCulture = ci;
                }
                return weightString;
            }
        }




      



       


        /// <summary>
        /// Gets the formattedNumber number.
        /// </summary>
        /// <param name="number">The number.</param>
        /// <returns></returns>
        public static string GetFormattedWeight6(double weight)
        {
            // Weight in Gramm
            weight = weight * 1000;
            double wei = Math.Round(weight);
            string weightString = Convert.ToString(weight);
            return weightString;

        }



        public static string GetFormattedWeight15(double weight)
        {
            if (weight == (double)0)
            {
                return "0.00";
            }
            else
            {
                weight = Math.Round(weight, 2);
                //Mit Punkt ist in Avisdatei gefordet 
                string weightString = Convert.ToString(weight).Replace(',', '.');
                return weightString;
            }
        }







      

     






    }
}




 //public static string GetFormattedWeight(double weight)
 //       {
 //           if (weight == (double)0)
 //           {
 //               return "";
 //           }
 //           else
 //           {
 //               weight = weight * 1000;
 //               string weightString = Convert.ToString(weight);
 //               return w eightString;
 //           }
 //       }

 


 //    public static string GetFormattedWeight(double weight)
 //       {
 //           // Weight in Gramm
 //           weight = weight * 1000;
 //           double wei = Math.Round(weight);
 //           string weightString = Convert.ToString(weight);
 //           return weightString;

 //       }


  //public static string GetFormattedWeight(double weight)
  //      {
  //          if (weight == (double)0)
  //          {
  //              return "0"; <<=============
  //          }
  //          else
  //          {
  //              // in dkg
  //              weight = weight * 100;
  //              weight = Math.Round(weight, 0);
  //              string weightString = Convert.ToString(weight);
  //              return weightString;
  //          }
  //      }

  //public static string GetFormattedWeight(double weight)
  //      {
  //          if (weight == (double)0)
  //          {
  //              return "0.00"; <<=============
  //          }
  //          else
  //          {
  //              weight = Math.Round(weight, 2);
  //              //Mit Punkt ist in Avisdatei gefordet 
  //              string weightString = Convert.ToString(weight).Replace(',', '.');
  //              return weightString;
  //          }
  //      }


  //public string GetFormattedWeight(double weight)
  //      {
  //          if (weight == (double)0)
  //          {
  //              return leerN;
  //          }
  //          else
  //          {
  //              return Convert.ToString(Math.Ceiling(weight));
  //          }
  //      }

   

  //public static string GetFormattedWeight(double weight)
  //      {
  //          if (weight == (double)0)
  //          {
  //              return "";
  //          }
  //          else
  //          {
  //              string weightString = "";
  //              CultureInfo ci = Thread.CurrentThread.CurrentCulture;
  //              try
  //              {
  //                  Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
  //                  weightString = String.Format("{0:###,##0.000}", weight);
  //              }
  //              finally
  //              {
  //                  Thread.CurrentThread.CurrentCulture = ci;
  //              }
  //              return weightString;
  //          }
  //      }